package com.wteam.dragon.shop.pojo.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gitee.sunchenbin.mybatis.actable.annotation.*;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import com.wteam.dragon.system.basebean.bean.BaseBean;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;

/**
 * SKU库存
 * @Author 陈晓辉
 * @Date 2020/7/7 19:33
 */
@Data
@Table
@TableName
@EqualsAndHashCode(callSuper = true)
public class SkuStock extends BaseBean {
    @IsKey
    @IsNotNull
    @IsAutoIncrement
    @TableId(type = IdType.AUTO)
    @ColumnType(MySqlTypeConstant.BIGINT)
    @Column(comment = "自增id")
    private Long id;

    @IsNotNull
    @Column(comment = "对应的商品id")
    @ColumnType(MySqlTypeConstant.BIGINT)
    private Long productId;

    @IsNotNull
    @Column(comment = "SKU编码")
    @ColumnType(MySqlTypeConstant.VARCHAR)
    private String skuCode;

    @IsNotNull
    @Column(comment = "价格")
    @ColumnType(value = MySqlTypeConstant.DECIMAL, length = 12, decimalLength = 2)
    private BigDecimal price;

    @IsNotNull
    @Column(comment = "库存")
    @ColumnType(MySqlTypeConstant.INT)
    @DefaultValue("0")
    private Integer stock;

    @IsNotNull
    @Column(comment = "库存预警")
    @ColumnType(MySqlTypeConstant.INT)
    @DefaultValue("0")
    private Integer lowStock;

    @Column(comment = "商品图片")
    @ColumnType(MySqlTypeConstant.VARCHAR)
    private String pic;

    @IsNotNull
    @Column(comment = "销量")
    @ColumnType(MySqlTypeConstant.BIGINT)
    @DefaultValue("0")
    private Long sale;

    @IsNotNull
    @Column(comment = "锁定库存")
    @ColumnType(MySqlTypeConstant.INT)
    @DefaultValue("0")
    private Integer lockStock;

    @Column(comment = "商品属性")
    @ColumnType(MySqlTypeConstant.TEXT)
    private String spData;
}
